﻿// Decompiled with JetBrains decompiler
// Type: SP1.ShapeElements
// Assembly: SP1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 4A78F1E7-7FD5-407C-8917-5F99ECC43C34
// Assembly location: C:\Users\KasimGulcan\Desktop\Project\DynaCAD\bin\Debug\SP1.dll

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Xml;

namespace SP1
{
  public static class ShapeElements
  {
    public static Ellipse CircleCreator(XmlNode xn)
    {
      bool flag = false;
      Ellipse x = new Ellipse();
      XmlAttributeCollection attributes = xn.Attributes;
      double StrokeOpacity = 1.0;
      double FillOpacity = 1.0;
      double? nullable1 = new double?();
      double? nullable2 = new double?();
      double? nullable3 = new double?(0.0);
      double? nullable4 = new double?(0.0);
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) attributes)
      {
        if (xmlAttribute.Value.Replace(" ", "") != "none")
        {
          switch (xmlAttribute.Name)
          {
            case "id":
              DefinitionElement.UIL.Add(new DefinitionElement.UIElements()
              {
                Name = xmlAttribute.Value,
                UI = (UIElement) x
              });
              break;
            case "cx":
              nullable1 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              break;
            case "cy":
              nullable2 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              break;
            case "r":
              x.Width = 2.0 * AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              nullable3 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              x.Height = 2.0 * AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              nullable4 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              break;
            case "stroke":
              x.Stroke = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              break;
            case "fill":
              x.Fill = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-miterlimit":
              x.StrokeMiterLimit = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-dasharray":
              x.StrokeDashArray = AtributeValueLibrary.StrokeDashArrayConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-width":
              x.StrokeThickness = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-linecap":
              x.StrokeEndLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              x.StrokeStartLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-opacity":
              StrokeOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "fill-opacity":
              FillOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "opacity":
              x.Opacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "transform":
              x = (Ellipse) TransFormLibrary.TransForm((UIElement) x, xmlAttribute.Value);
              break;
            case "stroke-linejoin":
              x.StrokeLineJoin = AtributeValueLibrary.LineJoinConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "style":
              x = AtributeValueLibrary.StyleAttribute(x, xmlAttribute.Value, out StrokeOpacity, out FillOpacity);
              flag = true;
              break;
          }
        }
        if (nullable1.HasValue)
        {
          Ellipse ellipse = x;
          double? nullable5 = nullable1;
          double? nullable6 = nullable3;
          double length = (nullable5.HasValue & nullable6.HasValue ? new double?(nullable5.GetValueOrDefault() - nullable6.GetValueOrDefault()) : new double?()).Value;
          Canvas.SetLeft((UIElement) ellipse, length);
        }
        if (nullable2.HasValue)
        {
          Ellipse ellipse = x;
          double? nullable5 = nullable2;
          double? nullable6 = nullable4;
          double length = (nullable5.HasValue & nullable6.HasValue ? new double?(nullable5.GetValueOrDefault() - nullable6.GetValueOrDefault()) : new double?()).Value;
          Canvas.SetTop((UIElement) ellipse, length);
        }
      }
      if (!flag)
        x = AtributeValueLibrary.StyleAttribute(x, DefinitionElement.style, out StrokeOpacity, out FillOpacity);
      if (x.Fill != null)
      {
        Brush brush = x.Fill.Clone();
        brush.Opacity = FillOpacity;
        x.Fill = brush;
      }
      if (x.Stroke != null)
      {
        Brush brush = x.Stroke.Clone();
        brush.Opacity = StrokeOpacity;
        x.Stroke = brush;
      }
      return x;
    }

    public static Ellipse EllipseCreator(XmlNode xn)
    {
      bool flag = false;
      Ellipse x = new Ellipse();
      XmlAttributeCollection attributes = xn.Attributes;
      double StrokeOpacity = 1.0;
      double FillOpacity = 1.0;
      double? nullable1 = new double?();
      double? nullable2 = new double?();
      double? nullable3 = new double?(0.0);
      double? nullable4 = new double?(0.0);
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) attributes)
      {
        if (xmlAttribute.Value.Replace(" ", "") != "none")
        {
          switch (xmlAttribute.Name)
          {
            case "id":
              DefinitionElement.UIL.Add(new DefinitionElement.UIElements()
              {
                Name = xmlAttribute.Value,
                UI = (UIElement) x
              });
              break;
            case "cx":
              nullable1 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              break;
            case "cy":
              nullable2 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              break;
            case "rx":
              x.Width = 2.0 * AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              nullable3 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              break;
            case "ry":
              x.Height = 2.0 * AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              nullable4 = new double?(AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              break;
            case "stroke":
              x.Stroke = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              break;
            case "fill":
              x.Fill = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-miterlimit":
              x.StrokeMiterLimit = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-dasharray":
              x.StrokeDashArray = AtributeValueLibrary.StrokeDashArrayConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-width":
              x.StrokeThickness = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-linecap":
              x.StrokeEndLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              x.StrokeStartLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "stroke-opacity":
              StrokeOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "fill-opacity":
              FillOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "opacity":
              x.Opacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "transform":
              x = (Ellipse) TransFormLibrary.TransForm((UIElement) x, xmlAttribute.Value);
              break;
            case "stroke-linejoin":
              x.StrokeLineJoin = AtributeValueLibrary.LineJoinConvertor(xmlAttribute.Value);
              flag = true;
              break;
            case "style":
              x = AtributeValueLibrary.StyleAttribute(x, xmlAttribute.Value, out StrokeOpacity, out FillOpacity);
              flag = true;
              break;
          }
        }
        if (nullable1.HasValue)
          Canvas.SetLeft((UIElement) x, nullable1.Value - nullable3.Value);
        if (nullable2.HasValue)
        {
          Ellipse ellipse = x;
          double? nullable5 = nullable2;
          double? nullable6 = nullable4;
          double length = (nullable5.HasValue & nullable6.HasValue ? new double?(nullable5.GetValueOrDefault() - nullable6.GetValueOrDefault()) : new double?()).Value;
          Canvas.SetTop((UIElement) ellipse, length);
        }
      }
      if (!flag)
        AtributeValueLibrary.StyleAttribute(x, DefinitionElement.style, out StrokeOpacity, out FillOpacity);
      if (x.Fill != null)
      {
        Brush brush = x.Fill.Clone();
        brush.Opacity = FillOpacity;
        x.Fill = brush;
      }
      if (x.Stroke != null)
      {
        Brush brush = x.Stroke.Clone();
        brush.Opacity = StrokeOpacity;
        x.Stroke = brush;
      }
      return x;
    }

    public static Line LineCreator(XmlNode xn)
    {
      bool flag = false;
      Line x = new Line();
      XmlAttributeCollection attributes = xn.Attributes;
      double StrokeOpacity = 1.0;
      double FillOpacity = 1.0;
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) attributes)
      {
        if (xmlAttribute.Value.Replace(" ", "") != "none")
        {
          switch (xmlAttribute.Name)
          {
            case "id":
              DefinitionElement.UIL.Add(new DefinitionElement.UIElements()
              {
                Name = xmlAttribute.Value,
                UI = (UIElement) x
              });
              continue;
            case "x1":
              x.X1 = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "y1":
              x.Y1 = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "x2":
              x.X2 = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "y2":
              x.Y2 = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "stroke":
              x.Stroke = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              continue;
            case "fill":
              x.Fill = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-miterlimit":
              x.StrokeMiterLimit = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-dasharray":
              x.StrokeDashArray = AtributeValueLibrary.StrokeDashArrayConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-opacity":
              StrokeOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill-opacity":
              FillOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-width":
              x.StrokeThickness = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linecap":
              x.StrokeEndLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              x.StrokeStartLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "opacity":
              x.Opacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "transform":
              x = (Line) TransFormLibrary.TransForm((UIElement) x, xmlAttribute.Value);
              continue;
            case "stroke-linejoin":
              x.StrokeLineJoin = AtributeValueLibrary.LineJoinConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "style":
              x = AtributeValueLibrary.StyleAttribute(x, xmlAttribute.Value, out StrokeOpacity, out FillOpacity);
              flag = true;
              continue;
            default:
              continue;
          }
        }
      }
      if (!flag)
        AtributeValueLibrary.StyleAttribute(x, DefinitionElement.style, out StrokeOpacity, out FillOpacity);
      if (x.Fill != null)
      {
        Brush brush = x.Fill.Clone();
        brush.Opacity = FillOpacity;
        x.Fill = brush;
      }
      if (x.Stroke != null)
      {
        Brush brush = x.Stroke.Clone();
        brush.Opacity = StrokeOpacity;
        x.Stroke = brush;
      }
      return x;
    }

    public static Path PathCreator(XmlNode xn)
    {
      bool flag = false;
      Path x = new Path();
      XmlAttributeCollection attributes = xn.Attributes;
      double StrokeOpacity = 1.0;
      double FillOpacity = 1.0;
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) attributes)
      {
        if (xmlAttribute.Value.Replace(" ", "") != "none")
        {
          switch (xmlAttribute.Name)
          {
            case "id":
              DefinitionElement.UIL.Add(new DefinitionElement.UIElements()
              {
                Name = xmlAttribute.Value,
                UI = (UIElement) x
              });
              continue;
            case "d":
              x.Data = Geometry.Parse(xmlAttribute.Value);
              continue;
            case "stroke":
              x.Stroke = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill":
              x.Fill = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-miterlimit":
              x.StrokeMiterLimit = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-dasharray":
              x.StrokeDashArray = AtributeValueLibrary.StrokeDashArrayConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-width":
              x.StrokeThickness = Convert.ToDouble(xmlAttribute.Value.Replace(".", ","));
              flag = true;
              continue;
            case "stroke-linecap":
              x.StrokeEndLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              x.StrokeStartLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-opacity":
              StrokeOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill-opacity":
              FillOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "opacity":
              x.Opacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linejoin":
              x.StrokeLineJoin = AtributeValueLibrary.LineJoinConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "transform":
              x = (Path) TransFormLibrary.TransForm((UIElement) x, xmlAttribute.Value);
              continue;
            case "style":
              x = AtributeValueLibrary.StyleAttribute(x, xmlAttribute.Value, out StrokeOpacity, out FillOpacity);
              flag = true;
              continue;
            default:
              continue;
          }
        }
      }
      if (!flag)
        x = AtributeValueLibrary.StyleAttribute(x, DefinitionElement.style, out StrokeOpacity, out FillOpacity);
      if (x.Fill != null)
      {
        Brush brush = x.Fill.Clone();
        brush.Opacity = FillOpacity;
        x.Fill = brush;
      }
      if (x.Stroke != null)
      {
        Brush brush = x.Stroke.Clone();
        brush.Opacity = StrokeOpacity;
        x.Stroke = brush;
      }
      return x;
    }

    public static Polygon PolygonCreator(XmlNode xn)
    {
      bool flag = false;
      Polygon x = new Polygon();
      XmlAttributeCollection attributes = xn.Attributes;
      double StrokeOpacity = 1.0;
      double FillOpacity = 1.0;
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) attributes)
      {
        if (xmlAttribute.Value.Replace(" ", "") != "none")
        {
          switch (xmlAttribute.Name)
          {
            case "id":
              DefinitionElement.UIL.Add(new DefinitionElement.UIElements()
              {
                Name = xmlAttribute.Value,
                UI = (UIElement) x
              });
              continue;
            case "points":
              x.Points = AtributeValueLibrary.PointCollectionConvertor(xmlAttribute.Value);
              continue;
            case "fill":
              x.Fill = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke":
              x.Stroke = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-miterlimit":
              x.StrokeMiterLimit = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-dasharray":
              x.StrokeDashArray = AtributeValueLibrary.StrokeDashArrayConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-width":
              x.StrokeThickness = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linecap":
              x.StrokeEndLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              x.StrokeStartLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-opacity":
              StrokeOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill-opacity":
              FillOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "opacity":
              x.Opacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linejoin":
              x.StrokeLineJoin = AtributeValueLibrary.LineJoinConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill-rule":
              x.FillRule = AtributeValueLibrary.FillRuleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "transform":
              x = (Polygon) TransFormLibrary.TransForm((UIElement) x, xmlAttribute.Value);
              continue;
            case "style":
              x = AtributeValueLibrary.StyleAttribute(x, xmlAttribute.Value, out StrokeOpacity, out FillOpacity);
              flag = true;
              continue;
            default:
              continue;
          }
        }
      }
      if (!flag)
        AtributeValueLibrary.StyleAttribute(x, DefinitionElement.style, out StrokeOpacity, out FillOpacity);
      if (x.Fill != null)
      {
        Brush brush = x.Fill.Clone();
        brush.Opacity = FillOpacity;
        x.Fill = brush;
      }
      if (x.Stroke != null)
      {
        Brush brush = x.Stroke.Clone();
        brush.Opacity = StrokeOpacity;
        x.Stroke = brush;
      }
      return x;
    }

    public static Polyline PolylineCreator(XmlNode xn)
    {
      bool flag = false;
      Polyline x = new Polyline();
      XmlAttributeCollection attributes = xn.Attributes;
      double StrokeOpacity = 1.0;
      double FillOpacity = 1.0;
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) attributes)
      {
        if (xmlAttribute.Value.Replace(" ", "") != "none")
        {
          switch (xmlAttribute.Name)
          {
            case "id":
              DefinitionElement.UIL.Add(new DefinitionElement.UIElements()
              {
                Name = xmlAttribute.Value,
                UI = (UIElement) x
              });
              continue;
            case "points":
              x.Points = AtributeValueLibrary.PointCollectionConvertor(xmlAttribute.Value);
              continue;
            case "fill":
              x.Fill = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke":
              x.Stroke = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-miterlimit":
              x.StrokeMiterLimit = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-dasharray":
              x.StrokeDashArray = AtributeValueLibrary.StrokeDashArrayConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-width":
              x.StrokeThickness = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linecap":
              x.StrokeEndLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              x.StrokeStartLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-opacity":
              StrokeOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill-opacity":
              FillOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "opacity":
              x.Opacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linejoin":
              x.StrokeLineJoin = AtributeValueLibrary.LineJoinConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill-rule":
              x.FillRule = AtributeValueLibrary.FillRuleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "transform":
              x = (Polyline) TransFormLibrary.TransForm((UIElement) x, xmlAttribute.Value);
              continue;
            case "style":
              x = AtributeValueLibrary.StyleAttribute(x, xmlAttribute.Value, out StrokeOpacity, out FillOpacity);
              flag = true;
              continue;
            default:
              continue;
          }
        }
      }
      if (!flag)
        AtributeValueLibrary.StyleAttribute(x, DefinitionElement.style, out StrokeOpacity, out FillOpacity);
      if (x.Fill != null)
      {
        Brush brush = x.Fill.Clone();
        brush.Opacity = FillOpacity;
        x.Fill = brush;
      }
      if (x.Stroke != null)
      {
        Brush brush = x.Stroke.Clone();
        brush.Opacity = StrokeOpacity;
        x.Stroke = brush;
      }
      return x;
    }

    public static Rectangle RectangleCreator(XmlNode xn)
    {
      bool flag = false;
      Rectangle x = new Rectangle();
      XmlAttributeCollection attributes = xn.Attributes;
      double StrokeOpacity = 1.0;
      double FillOpacity = 1.0;
      foreach (XmlAttribute xmlAttribute in (XmlNamedNodeMap) attributes)
      {
        if (xmlAttribute.Value.Replace(" ", "") != "none")
        {
          switch (xmlAttribute.Name)
          {
            case "id":
              DefinitionElement.UIL.Add(new DefinitionElement.UIElements()
              {
                Name = xmlAttribute.Value,
                UI = (UIElement) x
              });
              continue;
            case "x":
              Canvas.SetLeft((UIElement) x, AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              continue;
            case "y":
              Canvas.SetTop((UIElement) x, AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value));
              continue;
            case "rx":
              x.RadiusX = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "ry":
              x.RadiusY = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "width":
              x.Width = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "height":
              x.Height = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              continue;
            case "stroke":
              x.Stroke = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill":
              x.Fill = AtributeValueLibrary.GetBrush(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-miterlimit":
              x.StrokeMiterLimit = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-dasharray":
              x.StrokeDashArray = AtributeValueLibrary.StrokeDashArrayConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-width":
              x.StrokeThickness = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linecap":
              x.StrokeStartLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              x.StrokeEndLineCap = AtributeValueLibrary.LineCapConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-linejoin":
              x.StrokeLineJoin = AtributeValueLibrary.LineJoinConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "opacity":
              x.Opacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "fill-opacity":
              FillOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "stroke-opacity":
              StrokeOpacity = AtributeValueLibrary.DoubleConvertor(xmlAttribute.Value);
              flag = true;
              continue;
            case "transform":
              x = (Rectangle) TransFormLibrary.TransForm((UIElement) x, xmlAttribute.Value);
              continue;
            case "style":
              x = AtributeValueLibrary.StyleAttribute(x, xmlAttribute.Value, out StrokeOpacity, out FillOpacity);
              flag = true;
              continue;
            default:
              continue;
          }
        }
      }
      if (!flag)
        AtributeValueLibrary.StyleAttribute(x, DefinitionElement.style, out StrokeOpacity, out FillOpacity);
      if (x.Fill != null)
      {
        Brush brush = x.Fill.Clone();
        brush.Opacity = FillOpacity;
        x.Fill = brush;
      }
      if (x.Stroke != null)
      {
        Brush brush = x.Stroke.Clone();
        brush.Opacity = StrokeOpacity;
        x.Stroke = brush;
      }
      return x;
    }
  }
}
